﻿using System;
using System.Collections.Generic;
using System.Text;

namespace IceDog.DNL.CSharp.DesignPattern.SingletonPattern.Color
{
    /// <summary>
    /// 懒汉式-线程安全
    /// </summary>
    public class ColorManager
    {
        private ColorManager()
        {
            InitCounter += 1;
        }

        private static ColorManager _manager;
        private static readonly object _lockObj = new object();
        public static int InitCounter;
        public static ColorManager Instance
        {
            get
            {
                lock (_lockObj)
                {
                    if (_manager == null)
                    {
                        _manager = new ColorManager();
                    }
                    return _manager;
                }
            }
        }

        public string GetWhite()
        {
            return "White";
        }

        public string GetWhiteCode()
        {
            return "#FFFFFF";
        }

        public string GetBlack()
        {
            return "Black";
        }

        public string GetBlackCode()
        {
            return "#000000";
        }
    }
}
